package com.koron.css2.serviceManage.mapper;

import com.koron.css2.serviceManage.bean.BusinessAbodeBean;
import com.koron.css2.serviceManage.queryBean.BusinessAbodeQueryBean;
import com.koron.css2.serviceManage.vo.BusinessAbodeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;
@EnvSource("_default")
public interface BusinessAbodeMapper {

    /**
     * 校验字段内容重复
     */
    @Select("select count(*) from PUB_BUSINESS_ABODE where ${key} = #{val}")
    Integer check(@Param("key") String key, @Param("val") String val);

    /**
     * 校验字段内容重复-排除当前记录
     */
    @Select("select count(*) from PUB_BUSINESS_ABODE where ${key} = #{val} and id <> #{id}")
    Integer check2(@Param("key") String key, @Param("val") String val, @Param("id") String id);

    /**
     * 新增营业所
     *
     * @param bean
     * @return
     */
    Integer insertBusinessAbode(BusinessAbodeBean bean);

    /**
     * 根据id查询营业所
     *
     * @param id
     * @return
     */
    @Select("select * from PUB_BUSINESS_ABODE where id = #{id}")
    BusinessAbodeBean selectBusinessAbodeById(@Param("id") String id);

    /**
     * 列表查询
     *
     * @return
     */
    List<BusinessAbodeVo> selectBusinessAbodeList(BusinessAbodeQueryBean bean);

    /**
     * 修改营业所
     *
     * @param bean
     * @return
     */
    Integer updateBusinessAbode(BusinessAbodeBean bean);

}
